Skip to content

refactor: FunctionSignature return type container#8717

Open
canerakdas wants to merge 3 commits intonodejs:mainfrom
canerakdas:refactor/function-signature-returns
Open

refactor: FunctionSignature return type container#8717
canerakdas wants to merge 3 commits intonodejs:mainfrom
canerakdas:refactor/function-signature-returns

Conversation

@canerakdas
Copy link
Member

Description

As discussed on Slack, this PR includes moving the first return in the FunctionSignature component outside of the container.

Validation

image

@canerakdas canerakdas requested a review from a team as a code owner March 12, 2026 16:12
Copilot AI review requested due to automatic review settings March 12, 2026 16:12
@vercel
Copy link

vercel bot commented Mar 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nodejs-org Ready Ready Preview Mar 12, 2026 4:24pm

Request Review

@github-actions
Copy link
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.07%. Comparing base (62a66aa) to head (01dff78).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8717      +/-   ##
==========================================
- Coverage   75.10%   75.07%   -0.04%     
==========================================
  Files         104      104              
  Lines        9167     9167              
  Branches      315      316       +1     
==========================================
- Hits         6885     6882       -3     
- Misses       2280     2283       +3     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Mar 12, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 96 🟢 93 🟢 100 🟢 100 🔗
/en/about 🟢 99 🟢 94 🟢 100 🟠 88 🔗
/en/about/previous-releases 🟢 97 🟢 97 🟢 100 🟢 100 🔗
/en/download 🟢 99 🟢 96 🟠 81 🟢 100 🔗
/en/download/archive/current 🟢 100 🟢 97 🟢 100 🟢 100 🔗
/en/blog 🟢 100 🟢 97 🟢 96 🟢 100 🔗

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts how FunctionSignature renders return types so that top-level kind: 'return' entries are displayed outside the titled signature container, aligning the UI with the Slack discussion and provided validation screenshot.

Changes:

  • Split items into non-return “attributes” vs. kind: 'return' entries and render them separately when a title is provided.
  • Extend the Storybook Nested story to include an additional top-level return example.
  • Add bottom spacing to the SignatureRoot container and bump @node-core/ui-components version to 1.6.3.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/ui-components/src/Containers/FunctionSignature/index.tsx Separates top-level return items from attribute items when rendering a titled signature.
packages/ui-components/src/Containers/FunctionSignature/index.stories.tsx Adds a nested story case with a top-level return entry to validate the new layout.
packages/ui-components/src/Common/Signature/SignatureRoot/index.module.css Adds mb-1 to the signature root container to improve spacing between sections.
packages/ui-components/package.json Bumps the package version from 1.6.2 to 1.6.3.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@ovflowd
Copy link
Member

ovflowd commented Mar 12, 2026

Really good stuff <3


const FunctionSignature: FC<FunctionSignatureProps> = ({ title, items }) => {
if (title) {
const attributes: Array<SignatureDefinition> = [];
Copy link
Member

@araujogui araujogui Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would:

const { attributes, returnTypes } = items.reduce(
  (acc, item) => {
    (item.kind === 'return' ? acc.returnTypes : acc.attributes).push(item);
    return acc;
  },
  { attributes: [] as SignatureDefinition[], returnTypes: [] as SignatureDefinition[] }
);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or at least

const attributes: SignatureDefinition[] = [];
const returnTypes: SignatureDefinition[] = [];

for (const item of items) {
  const target = item.kind === 'return' ? returnTypes : attributes;
  target.push(item);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants